package com.macro.mall.model;

import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * ti_training_video实体类
 *
 * @author gaodx
 *
 */
@Data
@ApiModel(description = "课程报文",value = "课程报文")
public class TiTrainingVideo implements Serializable{
	/***/
    @ApiModelProperty(value = "")
	private Integer id; 
	/**课程分组id*/
    @NotNull(message = "课程分组id不可为空")
    @ApiModelProperty(value = "课程分组id")
	private Integer courseId; 
	/**名称*/
    @NotNull(message = "名称不可为空")
    @ApiModelProperty(value = "名称")
	private String videoName; 
	/**标题*/
    @ApiModelProperty(value = "标题")
	private String videoTitle; 
	/**地址*/
    @NotNull(message = "视频地址不可为空")
    @ApiModelProperty(value = "地址")
	private String videoUrl; 
	/**视频时长*/
    @NotNull(message = "视频时长不可为空")
    @ApiModelProperty(value = "视频时长")
	private String videoLength; 
	/**01-可用 02-不可用*/
    @ApiModelProperty(value = "01-可用 02-不可用")
	private String status; 
	/**创建时间*/
    @ApiModelProperty(value = "创建时间")
	private Date createTime; 
	/**修改时间*/
    @ApiModelProperty(value = "修改时间")
	private Date updateTime; 
	/**
	 * 实例化
	 */
	public TiTrainingVideo() {
		super();
	}
	/**
	 * 实例化
	 * 
	 * @param obj
	 */

	public TiTrainingVideo(JSONObject obj) {
		this();
		if (obj.get("id") instanceof Number) {
			this.setId(((Number) obj.get("id")).intValue());
		}
		if (obj.get("courseId") instanceof Number) {
			this.setCourseId(((Number) obj.get("courseId")).intValue());
		}
		if (obj.get("videoName") instanceof String) {
			this.setVideoName((String) obj.get("videoName"));
		}
		if (obj.get("videoTitle") instanceof String) {
			this.setVideoTitle((String) obj.get("videoTitle"));
		}
		if (obj.get("videoUrl") instanceof String) {
			this.setVideoUrl((String) obj.get("videoUrl"));
		}
		if (obj.get("videoLength") instanceof String) {
			this.setVideoLength((String) obj.get("videoLength"));
		}
		if (obj.get("status") instanceof String) {
			this.setStatus((String) obj.get("status"));
		}
		this.setCreateTime((Date) obj.get("createTime"));
		this.setUpdateTime((Date) obj.get("updateTime"));
	}
	
	/**
	 * 将当前对象转换为JsonObject
	 * 
	 * @return
	 */
	public JSONObject toJson() {
		JSONObject result = new JSONObject();
		if (this.getId() != null) {
			result.put("id",this.getId());
		}
		if (this.getCourseId() != null) {
			result.put("courseId",this.getCourseId());
		}
		if (this.getVideoName() != null) {
			result.put("videoName",this.getVideoName());
		}
		if (this.getVideoTitle() != null) {
			result.put("videoTitle",this.getVideoTitle());
		}
		if (this.getVideoUrl() != null) {
			result.put("videoUrl",this.getVideoUrl());
		}
		if (this.getVideoLength() != null) {
			result.put("videoLength",this.getVideoLength());
		}
		if (this.getStatus() != null) {
			result.put("status",this.getStatus());
		}
		if (this.getCreateTime() != null) {
			result.put("createTime",this.getCreateTime());
		}
		if (this.getUpdateTime() != null) {
			result.put("updateTime",this.getUpdateTime());
		}
		return result;
	}


	@Override
	public String toString() {
		return "TiTrainingVideo [id=" + id + " , courseId=" + courseId + " , videoName=" + videoName + " , videoTitle=" + videoTitle + " , videoUrl=" + videoUrl + " , videoLength=" + videoLength + " , status=" + status + " , createTime=" + createTime + " , updateTime=" + updateTime + "  ]";
	
	}
	
	
}
